Definition:
- When you occasionally find yourself staring at a spec that looks exactly like the code under test, there’s surprisingly little win left to enjoy.
Also Known As:
- Tautological tests
Code Example:
require "test/unit"
User = Struct.new(:first_name, :last_name, :email) do
def to_s
"#{last_name}, #{first_name} <#{email}>"
end
end
class UserTest < Test::Unit::TestCase
def test_to_s_includes_name_and_email
user = User.new("John", "Smith", "jsmith@example.com")
assert_equal "#{user.last_name}, #{user.first_name} <#{user.email}>", user.to_s
end
end
References:
Quality attributes
- :octicon:`file-code;1em` - Code Example
- :octicon:`comment-discussion;1em` - Cause and Effect
- :octicon:`graph;1em` - Frequency
- :octicon:`sync;1em` - Refactoring
- Anti-Patterns - Digital Tapestry
- Java: code duplication in classes and their junit test cases
- Smells in software test code: A survey of knowledge in industry and academia
- Testing anti-patterns: How to fail with 100% test coverage :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`sync;1em`
- Testing anti-patterns: The ugly mirror :octicon:`file-code;1em`